#!/usr/bin/env python -W ignore

# Testing for library completeness

import cherrypy
from lib.mutagen import *

class Root:
	@cherrypy.expose
	def setCookieOne(self):
		cookie = cherrypy.response.cookie
		cookie['cookieName'] = 'Scott'
		cookie['cookieName']['path'] = '/'
		cookie['cookieName']['max-age'] = 3600
		cookie['cookieName']['version'] = 1
		return "<html><body>Hello, I just sent you a cookie</body></html>"

	@cherrypy.expose
	def setCookieTwo(self):
		cookie = cherrypy.response.cookie
		cookie['cookieName'] = 'Black'
		cookie['cookieName']['path'] = '/'
		cookie['cookieName']['max-age'] = 3600
		cookie['cookieName']['version'] = 1
		return "<html><body>Hello, I just sent you a cookie</body></html>"

	@cherrypy.expose
	def readCookie(self):
		cookie = cherrypy.request.cookie
		res = """<html><body>Hi, you sent me %s cookies.<br />
			Here is a list of cookie names/values:<br />""" % len(cookie)
		for name in cookie.keys():
		    res += "name: %s, value: %s<br>" % (name, cookie[name].value)
		return res + "</body></html>"

cherrypy.quickstart(Root())


if __name__ == '__main__':
    # CherryPy always starts with app.root when trying to map request URIs
    # to objects, so we need to mount a request handler root. A request
    # to '/' will be mapped to HelloWorld().index().
    cherrypy.quickstart(Root())
